#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow ( QWidget* parent ) :
    QMainWindow ( parent ),
    ui ( new Ui::MainWindow )
{
    ui->setupUi ( this );
    connect ( &m2, SIGNAL ( signalFindServer ( QString, int ) ),
              this, SLOT ( on_findserver ( QString, int ) ) );
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked ( bool checked )
{
    list0.clear();
    m2.sendFindServer();
}

void MainWindow::on_findserver ( QString ip, int port )
{
    static QStringListModel model;
    ui->listView->setModel ( &model );

    list0 << QString ( "%1, %2" ).arg ( ip ).arg ( port );
    model.setStringList ( list0 );
}
